#ifndef FONTSETTINGS_H
#define FONTSETTINGS_H

#include <QtCore/QString>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QVector>
#include <QtGui/QFont>

QT_BEGIN_NAMESPACE
class QTextCharFormat;
class QSettings;
QT_END_NAMESPACE

namespace CodeEdit {

class FormatDescription;

/**
 * Font settings (default font and enumerated list of formats).
 */
class FontSettings
{
public:
    typedef QList<FormatDescription> FormatDescriptions;

public:
    FontSettings();

    void toSettings(QSettings *s) const;
    void fromSettings(QSettings *s);

    bool equals(const FontSettings &f) const;

    void clear();

    QVector<QTextCharFormat> toTextCharFormats(const QVector<QString> &categories) const;
    QTextCharFormat toTextCharFormat(const QString &category) const;

    QString fontFamily() const;
    void setFontFamily(const QString &family);

    int fontSize() const;
    void setFontSize(int size);

    inline QFont font() const { return QFont(fontFamily(), fontSize()); }

    bool antialias() const;
    void setAntialias(bool antialias);

    static QString defaultFixedFontFamily();
    static int defaultFontSize();

private:
    QString _family;
    QString _schemeFileName;
    int _fontSize;
    bool _antialias;
};

inline bool operator==(const FontSettings &fs1, const FontSettings &fs2) { return fs1.equals(fs2); }
inline bool operator!=(const FontSettings &fs1, const FontSettings &fs2) { return !fs1.equals(fs2); }

} // namespace CodeEdit

#endif // FONTSETTINGS_H
